What permission to save data with getContentResolver()

All your problems with Audio, Video and Images.

What permission to save data with getContentResolver()

Postby Dayn » Thu Aug 20, 2009 10:13 am

Hi

What kind of permission I have to implement into AndroidManifest.xml ???

I want to save my byte[] which is a decoded base64 String.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.      package="com.dany.android.socketinterface"
  4.      android:versionCode="1"
  5.      android:versionName="1.0">
  6.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  7.  
  8.  
  9.                 <activity android:name=".InterfaceGraphiqueVVM"
  10.                  android:label="@string/app_name">
  11.             <intent-filter>
  12.                 <action android:name="android.intent.action.MAIN" />
  13.                 <category android:name="android.intent.category.LAUNCHER" />
  14.             </intent-filter>
  15.         </activity>        
  16.        
  17.         <activity android:name=".TabVoicemail"
  18.                           android:label="Voicemail">
  19.             <intent-filter>
  20.                 <action android:name="android.intent.action.MAIN"/>
  21.                 <category android:name="android.intent.category.SAMPLE_CODE"/>
  22.             </intent-filter>
  23.         </activity>
  24.        
  25.         <activity android:name=".TabConfig"
  26.                  android:label="Configuration">
  27.             <intent-filter>
  28.                 <action android:name="android.intent.action.MAIN"/>
  29.                 <category android:name="android.intent.category.SAMPLE_CODE"/>
  30.             </intent-filter>
  31.         </activity>
  32.  
  33.  
  34.     </application>
  35.    
  36.     <uses-permission
  37.       android:name="android.permission.INTERNET">
  38.     </uses-permission>  
  39.    
  40.     <uses-permission    
  41.       android:name="android.permission.SUBSCRIBED_FEEDS_WRITE">    
  42.     </uses-permission>
  43.    
  44.     <uses-permission    
  45.       android:name="android.permission.SUBSCRIBED_FEEDS_READ">
  46.     </uses-permission>
  47.    
  48.     <uses-permission    
  49.       android:name="android.permission.WRITE_OWNER_DATA">
  50.     </uses-permission>
  51.    
  52.     <uses-permission    
  53.       android:name="android.permission.WRITE_SETTINGS">
  54.     </uses-permission>
  55.     <uses-sdk android:minSdkVersion="3" />
  56. </manifest>
Parsed in 0.007 seconds, using GeSHi 1.0.8.4


I try a lot of permission but I always have error exception:

08-20 09:01:22.538: DEBUG/AndroidRuntime(2787): Shutting down VM
08-20 09:01:22.547: WARN/dalvikvm(2787): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
08-20 09:01:22.547: ERROR/AndroidRuntime(2787): Uncaught handler: thread main exiting due to uncaught exception
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dany.android.socketinterface/com.dany.android.socketinterface.InterfaceGraphiqueVVM}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dany.android.socketinterface/com.dany.android.socketinterface.TabVoicemail}: java.lang.NullPointerException
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.os.Handler.dispatchMessage(Handler.java:99)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.os.Looper.loop(Looper.java:123)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.main(ActivityThread.java:3948)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at java.lang.reflect.Method.invokeNative(Native Method)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at java.lang.reflect.Method.invoke(Method.java:521)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at dalvik.system.NativeStart.main(Native Method)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dany.android.socketinterface/com.dany.android.socketinterface.TabVoicemail}: java.lang.NullPointerException
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2112)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:600)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.widget.TabHost.setCurrentTab(TabHost.java:310)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.widget.TabHost.addTab(TabHost.java:203)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at com.dany.android.socketinterface.InterfaceGraphiqueVVM.onCreate(InterfaceGraphiqueVVM.java:24)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): ... 11 more
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): Caused by: java.lang.NullPointerException
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:89)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at com.dany.android.socketinterface.Client.start(Client.java:352)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at com.dany.android.socketinterface.TabVoicemail.onCreate(TabVoicemail.java:52)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-20 09:01:22.597: ERROR/AndroidRuntime(2787): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.     byte[] decoded = Base64.decode( tabMsg[0].getMsgBase64() );
  2.            
  3.             ContentValues values = new ContentValues();
  4.             values.put(Media.DISPLAY_NAME, "Voicemail");    
  5.             values.put(Media.CONTENT_TYPE, "Audio/wav");
  6.             values.put(Media._ID, 1);
  7.             values.put(Media.DATA, decoded);
  8.            
  9.             ContentResolver cr = getContentResolver();
  10.            
  11.             Uri uri = cr.insert(Media.INTERNAL_CONTENT_URI, values);
  12.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Did I forget something or an other permission ???

Dayn
User avatar
Dayn
Developer
Developer
 
Posts: 31
Joined: Thu Jul 09, 2009 10:45 am
Location: Paris and Dijon

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests