2

I am developing an ebook reader as an android app. But I want the downloaded ebook files (eg. epub) to be DRM protected. I referred to the links mentioned below and tried to implement it but resulted with an error. I am at very beginning level of implementing DRM.

My Code:

    DrmManagerClient drmManagerClient = new DrmManagerClient(getApplicationContext());
    DrmInfoRequest drmInfoRequest = new DrmInfoRequest(0, "text/plain"); //<--- Error in this line
    DrmInfo drmInfo = drmManagerClient.acquireDrmInfo(drmInfoRequest);
    Log.e("sth...: ", drmInfo.getInfoType() + "");

Error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.androiddrm/com.example.user.androiddrm.MainActivity}: java.lang.IllegalArgumentException: infoType: 0,mimeType: text/plain

The basic code above is implemented based on the following documentation:

  1. https://developer.android.com/reference/android/drm/package-summary.html

  2. https://developer.android.com/reference/android/drm/DrmManagerClient.html#acquireDrmInfo(android.drm.DrmInfoRequest)

  3. https://developer.android.com/reference/android/drm/DrmInfoRequest.html

  4. https://source.android.com/devices/drm#DrmInfo

Now the Link 4 explains about drm but using MediaPlayer as example but mine is for epub files. Even though the implementation of acquireDrmInfo() is different as followed to the above 3 links.

This link specifically targets for media player Exoplayer, so not much of help.

Note: After the epub file is downloaded, the user should be able to read offline so I don't think there will be any online activity.

So how to fix above error and is there any better tutorials on using Android.Drm Framework?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sagaryal
  • 415
  • 4
  • 15
  • I would like to request the viewer of this question to UPVOTE this question since it might reach to the people who are expert in it. Thankyou – Sagaryal Dec 29 '17 at 01:41
  • are you still trying to solve your react-native DRM issue (https://stackoverflow.com/questions/47960233/how-do-i-implement-drm-on-react-native) and bridge the native Java code, or are you reverting to java completely for your application? – Tristan van Dam Jan 12 '18 at 16:51

0 Answers0