2013-04-15 4 views
13

Manifestandroid:sharedUserId="android.uid.system"を使用してシステムアプリとしてカスタムROMにロードされるアプリからBroadcastを送信する際に問題が発生しました。システムアプリでsendBroadcastを使用する

シンプルsendBroadcastを実行しようとしたとき、私は取得しています問題は次のとおりです。

Intent newIntent = new Intent(intent.getExtras().getString(BUNDLE_ACTION_TO_REPLY_ON)); 
newIntent.putExtra(BUNDLE_FILE_URI, bitmapFile.getAbsolutePath()); 
newIntent.putExtra(BUNDLE_REPLY_WIDTH, width); 
newIntent.putExtra(BUNDLE_REPLY_HEIGHT, height); 
newIntent.putExtra(BUNDLE_REPLY_EXTRA, extra); 
context.sendBroadcast(newIntent); 

私はLogcatでこの警告取得しています:これはによって送り出されている

Calling a method in the system process without a qualified user

warnIfCallingFromSystemProcess()プロセスにおけるContextImpl.java

なぜ誰かが知っていますか(そして私がそれを "修正"する必要がある場合)?

+0

コンテキストを初期化する場所を表示できますか? – RvdK

+0

ブロードキャストレシーバの一部として渡されます( 'public void onReceive(最終コンテキストコンテキスト、最終インテントインテント)') – Graeme

+0

このBroadcastReceiverはシステムアプリケーションですか? – RvdK

答えて

9

sendBroadcast(Intent intent)ではなく、以下の関数を使用します。例えば

空隙sendBroadcastAsUser(意図意図、UserHandleユーザ)

context.sendBroadcastAsUser(newIntent、新しいUserHandle(UserHandle.USER_CURRENT))。

+0

これは、プリインストールされていないアプリケーションでは使用できません。[link](http://goo.gl/J1GIXq) – MatPag

+0

@Mat:はい。それはシステムアプリだけです。 – sMiLo

+0

'UserHandle.USER_CURRENT'パラメータとは何ですか? –

関連する問題