2017-02-10 22 views
0

Тезисы 2 ошибок продолжают отображаться. Я много искал для решений, но я не мог их исправить.android Не удалось найти информацию о провайдере

E/NetworkScheduler.SR: Неверное имя пакета: Возможно, вы не включили PendingIntent в дополнительные функции?

E/ActivityThread: Не удалось найти информацию поставщика для com.playpersia.bicyclemap.LocationssProviderslocation

Мой Provider

public class LocationssProviders extends ContentProvider { 

String TAG="LocationssProviders"; 

public static String AUTHORITY="com.playpersia.bicyclemap.LocationssProviders"; 
public static final Uri CONTENT_URI =Uri.parse("content://" +AUTHORITY + "locations"); 

// MIME types used for searching words or looking up a single location 

public static final String LOCATION_MIME_TYPE= ContentResolver.CURSOR_DIR_BASE_TYPE + 
     "/com.playpersia.bicyclemap"; 

public static final String DEFINITION_MIME_TYPE =ContentResolver.CURSOR_DIR_BASE_TYPE + 
     "/com.playpersia.bicyclemap"; 

private LocationDatabase mLocation; 

//UriMatcher 

private static final int SEARCH_NAMES=0; 
private static final int GET_NAMES=1; 
private static final int SEARCH_SUGGEST=2; 
private static final int REFRESH_SHORTCUT=3; 
private static final UriMatcher sURIMATCHER= buildUriMatcher(); 


private static UriMatcher buildUriMatcher(){ 
    UriMatcher matcher= new UriMatcher(UriMatcher.NO_MATCH); 

    matcher.addURI(AUTHORITY , "locations", SEARCH_NAMES); 
    matcher.addURI(AUTHORITY, "locations/#", GET_NAMES); 

    matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY,SEARCH_SUGGEST); 
    matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + 
      "/*", SEARCH_SUGGEST); 



    matcher.addURI(AUTHORITY,SearchManager.SUGGEST_URI_PATH_SHORTCUT,REFRESH_SHORTCUT); 
    matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT 
      +"/*", REFRESH_SHORTCUT); 

    return matcher; 

} 
@Override 
public boolean onCreate() { 

    mLocation= new LocationDatabase(getContext()); 

    return true; 
} 

@Nullable 
@Override 
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { 
    switch (sURIMATCHER.match(uri)) 
    { 
     case SEARCH_SUGGEST: 
      if (selectionArgs == null){ 

       throw new IllegalArgumentException(
         "selectionArgs nust be provided for the Uri:" + uri); 
      } 

      return getSuggestion(selectionArgs[0]); 

     case SEARCH_NAMES: 

      if (selectionArgs == null) { 
       throw new IllegalArgumentException(
         "selectionArgs must be provided for the Uri: " + uri); 
      } 

      return search(selectionArgs[0]); 
     case GET_NAMES: 
      return getName(uri); 
     case REFRESH_SHORTCUT: 
      return refreshShortcut(uri); 
     default: 
      throw new IllegalArgumentException("Unknown Uri: " + uri); 

    } 

} 



private Cursor getSuggestion(String query) { 

    query=query.toLowerCase(); 
    String[] columns = new String[]{ 
      BaseColumns._ID, 
      LocationDatabase.KET_NAME, 
      LocationDatabase.KEY_LOCATION, 

      SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID 

    }; 

    return mLocation.getNameMatches(query, columns); 
} 

private Cursor search (String query){ 
    query=query.toLowerCase(); 
    String[] columns = new String[]{ 
      BaseColumns._ID, 
      LocationDatabase.KET_NAME, 
      LocationDatabase.KEY_LOCATION, 
    }; 

    return mLocation.getNameMatches(query, columns); 

} 

private Cursor getName(Uri uri){ 

    String rowId= uri.getLastPathSegment(); 
    String[] columns= new String[]{ 
      LocationDatabase.KET_NAME, 
      LocationDatabase.KEY_LOCATION, 

    }; 
    return mLocation.getName(rowId, columns); 
} 

private Cursor refreshShortcut(Uri uri) { 
    String rowId= uri.getLastPathSegment(); 
    String [] columns= new String[]{ 

      BaseColumns._ID, 
      LocationDatabase.KET_NAME, 
      LocationDatabase.KEY_LOCATION, 
      SearchManager.SUGGEST_COLUMN_SHORTCUT_ID, 
      SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID 

    }; 

    return mLocation.getName(rowId, columns); 
} 

@Nullable 
@Override 
public String getType(Uri uri) { 
    switch (sURIMATCHER.match(uri)){ 
     case SEARCH_NAMES: 
      return LOCATION_MIME_TYPE; 
     case GET_NAMES: 
      return DEFINITION_MIME_TYPE; 
     case SEARCH_SUGGEST: 
      return SearchManager.SUGGEST_MIME_TYPE; 
     case REFRESH_SHORTCUT: 
      return SearchManager.SHORTCUT_MIME_TYPE; 
     default: 
      throw new IllegalArgumentException("Unkniwn URL" + 
        uri); 
    } 
} 

@Nullable 
@Override 
public Uri insert(Uri uri, ContentValues values) { 
    throw new UnsupportedOperationException(); 
} 

@Override 
public int delete(Uri uri, String selection, String[] selectionArgs) { 
    throw new UnsupportedOperationException(); 

} 

@Override 
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { 
    throw new UnsupportedOperationException(); 

    } 
    } 

Manifrst

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    package="com.playpersia.bicyclemap"> 

    <uses-sdk 
     android:maxSdkVersion="24" 
     android:minSdkVersion="14" 
     android:targetSdkVersion="19" /> 

    <uses-permission 
     android:name="com.playpersia.bicyclemap.permission.MAP_RECEIVES" 
     android:protectionLevel="signature" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> 
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> 
    <permission 
     android:name="com.google.maps.android.utils.permission.MAPS_RECEIVE" 
     android:protectionLevel="signature"/> 
    <uses-permission android:name="com.google.maps.android.utils.permission.MAPS_RECEIVE"/> 
    <uses-permission android:name="android.permission.SET_DEBUG_APP"/> 
    <!-- To auto-complete the email text field in the login form with the user's emails --> 


    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:debuggable="true" 

     android:windowSoftInputMode="adjustPan|stateHidden" 
     android:theme="@style/Theme.AppCompat.Light.NoActionBar" 
     tools:replace="android:icon,android:theme"> 
     <uses-library android:name="com.google.android.maps" /> 

     <meta-data 
      android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version" /> 
     <meta-data 
      android:name="com.google.android.maps.v2.API_KEY" 
      android:value="AIzaSyBS8V9TGhcFUIpt0AIUORXr7-H4XZDQeXw" /> 

     <activity 
      android:name=".SplashActivity" 
      android:label="@string/title_activity_maps"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name=".MainActivity"> 

      <intent-filter> 

       <action android:name="android.intent.action.SEARCH"> 

       </action> 
      </intent-filter> 

      <meta-data android:name="android.app.searchable" 
       android:resource="@xml/searchable" 
       /> 

     </activity> 
     <activity android:name=".IntroWelcomePager.WelcomeActivity" /> 
     <activity android:name=".CheckNetConnActivity" /> 


     <!-- Provides search suggestions for words and their definitions. --> 

     <provider android:name="com.playpersia.bicyclemap.LocationssProviders" 
      android:authorities="com.playpersia.bicyclemap.LocationssProviders" 
      android:exported="true" 
      android:grantUriPermissions="true" 
      android:enabled="true" 
      android:multiprocess="true" 
      android:label="@string/provider_locations" 
      /> 
    </application> 

</manifest> 
+0

Вы забыли про "/" – Selvin

+0

спасибо, я исправил его. Но это все еще дает мне ошибку @Selvin – Hadis

ответ

0

Попробуйте

public static final Uri CONTENT_URI =Uri.parse("content://" +AUTHORITY); 

вместо

public static final Uri CONTENT_URI =Uri.parse("content://" +AUTHORITY + "locations"); 

Вам не нужно упоминать свой "месторасположение" контракт содержимого URI.

Надеюсь, это поможет.