2016-10-27 71 views
2

我有一個安卓系統應用程序正在安裝我的應用程序的Android設備。這個App有服務,並嘗試啓動該服務爲Android棉花糖:在沒有合格用戶的情況下調用系統進程中的方法:

static void startMyService(Context context, String action) { 
    Intent service = new Intent(context, MyService.class); 
    service.setAction(action); 
    context.startService(service); 
} 

以前我曾經在Android 5.1.1運行我的代碼,並將其用於正常工作,但現在我把它更新到6.0。現在我正在獲得以下日誌。

Line 209209: 01-02 01:30:51.215 I/ActivityManager(3571): Start proc 5678:com.example.myapp/1000 for broadcast com.example.myapp/.update.GenericBroadcastReceiver 
Line 209239: 01-02 01:30:51.377 W/art  (5678): <clinit> didn't have expected constructor access flag in class com.example.myapp.update.BootStrapperService in dex file /system/app/myApp.apk 
Line 209241: 01-02 01:30:51.378 W/art  (5678): <clinit> didn't have expected constructor access flag in class com.example.myapp.update.MyService in dex file /system/app/MyApp.apk 
Line 209255: 01-02 01:30:51.393 W/art  (5678): <clinit> didn't have expected constructor access flag in class com.example.myapp.update.UpdateState in dex file /system/app/MyApp.apk 
Line 209259: 01-02 01:30:51.400 W/ContextImpl(5678): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1221 android.content.ContextWrapper.startService:581 android.content.ContextWrapper.startService:581 com.example.myapp.update.MyService.startServiceWithAction:301 com.example.myapp.update.GenericBroadcastReceiver.onReceive:52 
Line 209259: 01-02 01:30:51.400 W/ContextImpl(5678): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1221 android.content.ContextWrapper.startService:581 android.content.ContextWrapper.startService:581 com.example.myapp.update.MyService.startMyService:301 com.example.myapp.update.GenericBroadcastReceiver.onReceive:52 
Line 209263: 01-02 01:30:51.408 E/PersistenceUtil(5678): unabled to read update configuration 

我有我的類的構造函數如下 用於爲MyService

public MyService() { 
    super("MyService"); 
} 

爲BootStrapperService

public BootStrapperService() { 
    super("BootStrapperService"); 
} 

請給我建議的方式來解決這個問題

+0

什麼問題發送廣播消息? –

+0

@ColdFire我的應用程序不運行 – Akshay

+0

我也有一個系統應用程序,我維護,並在startActivity和startService上下文方法上看到相同的警告日誌,但這兩種情況對我來說運行良好,我的應用程序整體運行良好。我一直在試圖找到一種方法來壓制這些,因爲它們很煩人,但到目前爲止我還沒有發現任何東西。不過,我認爲它們是良性的,而且在你的應用程序中還有其他問題,因爲它沒有運行。 – jschlepp

回答

0

嘗試調用它作爲一個用戶,使用一個句柄。 例如: 在系統服務

context.sendBroadcastAsUser(intent,UserHandle.ALL); 
相關問題