您可能必须向应用程序添加一些设置,这些设置存储在原生 Android 范围内的某个位置,并从 GCM 通知接收器中访问它们。
看看 SharedPreferences
http://developer.android.com/reference/android/content/SharedPreferences.html
例如:
//
// Save a shared preference
SharedPreferences sharedPreferences = context.getActivity().getSharedPreferences( "YOUR_PREFERENCES_NAME", Activity.MODE_PRIVATE );
Editor preferencesEditor = sharedPreferences.edit();
preferencesEditor.putString( "customNotificationSound", soundLocation );
preferencesEditor.commit();
然后在你的接收器中:
SharedPreferences sharedPreferences = context.getActivity().getSharedPreferences( "YOUR_PREFERENCES_NAME", Activity.MODE_PRIVATE );
String soundLocation = sharedPreferences.getBoolean( "customNotificationSound", false );