RadaeePDF.com :: Topic: Shared library and multiple licenses (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Shared library and multiple licenses

Shared library and multiple licenses 3 years 6 months ago #4924

  • bsautere
  • bsautere's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Hi,

In version 2.9.4 the method Global.Init(Activity act, int activate, String company, String email, String key) was available. This method allow us to share your library across multiples application projects, each application project having a different key stored in a property file.

Starting from 2.9.6 this method is gone. Can you put it back, or are you going to propose a different solution ?

Thanks,

Bernard
The administrator has disabled public write access.

Shared library and multiple licenses 3 years 6 months ago #4925

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 660
  • Thank you received: 38
  • Karma: 17
Dear Bernard,

The SDK never had the method Global.Init(Activity act, int activate, String company, String email, String key) we have only Global.Init(Activity act)..

I guess, you have added this method, which can easily be added again in the new version..
The administrator has disabled public write access.

Shared library and multiple licenses 3 years 6 months ago #4927

  • bsautere
  • bsautere's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Ok, I had a doubt as well, my bad.

So, can you provide such a solution ? Because we need it. And modifying your code with our licence key cause issue when you update your code, etc.
Last Edit: 3 years 6 months ago by rhys.
The administrator has disabled public write access.

Shared library and multiple licenses 3 years 6 months ago #4928

  • bsautere
  • bsautere's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Here is the modified code, with added method. I think it deserve to be added as official code.

/**
* Global initialize function for testing and development as it uses proprietary activation.
* It loads JNI library and writes some data to memory.
*
* @param act Activity object, must be called super.onCreate().
*/
public static void Init(Activity act)
{
// active library, or WaterMark will displayed on each page.
// Init(ACTIVATE_STANDARD, act, "radaee", "This email address is being protected from spambots. You need JavaScript enabled to view it.", "HV8A19-WOT9YC-9ZOU9E-OQ31K2-FADG6Z-XEBCAO");
// Init(ACTIVATE_PROFESSIONAL, act, "radaee", "This email address is being protected from spambots. You need JavaScript enabled to view it.", "Z5A7JV-5WQAJY-9ZOU9E-OQ31K2-FADG6Z-XEBCAO");
Init(act, ACTIVATE_PREMIUM, "radaee", "This email address is being protected from spambots. You need JavaScript enabled to view it.", "LNJFDN-C89QFX-9ZOU9E-OQ31K2-FADG6Z-XEBCAO");
}

/**
* global initialize function. it load JNI library and write some data to
* memory.
*
* @param act
* Activity object, must be called super.onCreate().
*/
public static void Init(Activity act, int activate, String company, String email, String key)
{
/*
* String devID =
* ((TelephonyManager)act.getSystemService(act.TELEPHONY_SERVICE
* )).getDeviceId(); if( devID == null ) { WifiManager wm =
* (WifiManager)act.getSystemService(act.WIFI_SERVICE); if( wm != null )
* { WifiInfo wi = wm.getConnectionInfo(); if( wi != null ) devID =
* wi.getMacAddress(); } }
*/
// load library
System.loadLibrary("rdpdf");

// save assets to files path for application.
// assets mainly include encoding map data.
AssetManager assets = act.getAssets();
byte buf[] = new byte[4096];
File sub;
int read;
File files = act.getFilesDir();
String cmaps_path = files.getAbsolutePath() + "/cmaps";// get destiny
// cmaps file
// path
String umaps_path = files.getAbsolutePath() + "/umaps";// get destiny
// umaps file
// path

String fonts_path = files.getAbsolutePath() + "/rdf013";

// create temporary dictionary, to save media or attachment data.
File sdDir = Environment.getExternalStorageDirectory();
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
tmp_path = sdDir.toString() + "/rdtmp";
File dir = new File(tmp_path);
if (!dir.exists())// not exist? make it!
dir.mkdir();
else if (!dir.isDirectory())
tmp_path = sdDir.getAbsolutePath();
} else if (sdDir != null)
tmp_path = sdDir.getAbsolutePath();// not mount? get sdcard path
else
tmp_path = files.getAbsolutePath() + "/rdtmp";
files = null;
Global.RemoveTmp();// clear temporary dictionary
files = new File(tmp_path);
files.mkdir();
files = null;

// save cmaps data from assets to files path
sub = new File(cmaps_path);
if (!sub.exists()) {
try {
InputStream src;

FileOutputStream dst = new FileOutputStream(
new File(cmaps_path));

src = assets.open("cmaps1");
while ((read = src.read(buf)) > 0)
dst.write(buf, 0, read);
src.close();
src = null;
src = assets.open("cmaps2");
while ((read = src.read(buf)) > 0)
dst.write(buf, 0, read);
src.close();
src = null;

dst.close();
dst = null;
src = null;
} catch (Exception e) {
}
}
sub = null;

// save umaps data from assets to files path
sub = new File(umaps_path);
if (!sub.exists()) {
try {
InputStream src;

FileOutputStream dst = new FileOutputStream(
new File(umaps_path));

src = assets.open("umaps1");
while ((read = src.read(buf)) > 0)
dst.write(buf, 0, read);
src.close();
src = null;
src = assets.open("umaps2");
while ((read = src.read(buf)) > 0)
dst.write(buf, 0, read);
src.close();
src = null;

dst.close();
dst = null;
src = null;
} catch (Exception e) {
}
}
sub = null;

sub = new File(fonts_path);
if( !sub.exists() )
{
try
{
InputStream src = assets.open("rdf013");
FileOutputStream dst = new FileOutputStream( new File(fonts_path) );
while( (read = src.read( buf )) > 0 )
dst.write( buf, 0, read );
dst.close();
src.close();
dst = null;
src = null;
}
catch(Exception e)
{
}
}
sub = null;

buf = null;
assets = null;

// active library, or WaterMark will displayed on each page.
// boolean succeeded = activeStandard(act, "radaee",
// "This email address is being protected from spambots. You need JavaScript enabled to view it.", "HV8A19-WOT9YC-9ZOU9E-OQ31K2-FADG6Z-XEBCAO");
// boolean succeeded = activeProfessional( act, "radaee",
// "This email address is being protected from spambots. You need JavaScript enabled to view it.", "Z5A7JV-5WQAJY-9ZOU9E-OQ31K2-FADG6Z-XEBCAO" );
//boolean succeeded = activePremium(act, "radaee", "This email address is being protected from spambots. You need JavaScript enabled to view it.",
// "LNJFDN-C89QFX-9ZOU9E-OQ31K2-FADG6Z-XEBCAO");

boolean succeeded = false;
switch(activate) {
case ACTIVATE_STANDARD:
succeeded = activeStandard(act, company, email, key);
break;
case ACTIVATE_PROFESSIONAL:
succeeded = activeProfessional(act, company, email, key);
break;
case ACTIVATE_PREMIUM:
succeeded = activePremium(act, company, email, key);
break;
}

// active library, or WaterMark will displayed on each page.
// these active function is binding to version string "201401".
//String ver = getVersion();
// boolean succeeded = activeStandardForVer(act, "Radaee",
// "This email address is being protected from spambots. You need JavaScript enabled to view it.", "NP8HLC-Q3M21C-H3CRUZ-WAJQ9H-5R5V9L-KM0Y1L");
// boolean succeeded = activeProfessionalForVer(act, "Radaee",
// "This email address is being protected from spambots. You need JavaScript enabled to view it.", "6D7KV9-FYCVAE-H3CRUZ-WAJQ9H-5R5V9L-KM0Y1L" );
// boolean succeeded = activePremiumForVer(act, "Radaee", "This email address is being protected from spambots. You need JavaScript enabled to view it.",
// "Q6EL00-BTB1EG-H3CRUZ-WAJQ9H-5R5V9L-KM0Y1L");

// set cmaps and umaps data.
setCMapsPath(cmaps_path, umaps_path);

loadStdFont( 13, fonts_path );

// add system external fonts.
fontfileListStart();
fontfileListAdd("/system/fonts/DroidSans.ttf");
fontfileListAdd("/system/fonts/Roboto-Regular.ttf");
fontfileListAdd("/system/fonts/DroidSansFallback.ttf");
fontfileListEnd();
int face_first = 0;
int face_count = getFaceCount();
String face_name = null;
while (face_first < face_count) {
face_name = getFaceName(face_first);
if (face_name != null)
break;
face_first++;
}
// set default font for fixed width font.
if (!setDefaultFont(null, "Roboto-Regular", true) && face_name != null)
{
if( !setDefaultFont(null, "DroidSans", true) )
setDefaultFont(null, face_name, true);
}
// set default font for non-fixed width font.
if (!setDefaultFont(null, "Roboto-Regular", false) && face_name != null)
{
if( !setDefaultFont(null, "DroidSans", false) )
setDefaultFont(null, face_name, false);
}

// set default font for Chinese simplified language.
if (!setDefaultFont("GB1", "DroidSansFallback", true)
&& face_name != null)
setDefaultFont(null, face_name, true);
if (!setDefaultFont("GB1", "DroidSansFallback", false)
&& face_name != null)
setDefaultFont(null, face_name, false);

// set default font for Chinese traditional language.
if (!setDefaultFont("CNS1", "DroidSansFallback", true)
&& face_name != null)
setDefaultFont(null, face_name, true);
if (!setDefaultFont("CNS1", "DroidSansFallback", false)
&& face_name != null)
setDefaultFont(null, face_name, false);

// set default font for Japanese.
if (!setDefaultFont("Japan1", "DroidSansFallback", true)
&& face_name != null)
setDefaultFont(null, face_name, true);
if (!setDefaultFont("Japan1", "DroidSansFallback", false)
&& face_name != null)
setDefaultFont(null, face_name, false);

// set default font for Korean.
if (!setDefaultFont("Korea1", "DroidSansFallback", true)
&& face_name != null)
setDefaultFont(null, face_name, true);
if (!setDefaultFont("Korea1", "DroidSansFallback", false)
&& face_name != null)
setDefaultFont(null, face_name, false);

if (!setAnnotFont("DroidSansFallback") && face_name != null) {
setAnnotFont(face_name);
}

// set text font for edit-box and combo-box editing.
if (!setAnnotFont("DroidSansFallback") && face_name != null) {
setAnnotFont(face_name);
}

// set configure to default value
default_config();
}
The administrator has disabled public write access.

Shared library and multiple licenses 3 years 6 months ago #4929

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 660
  • Thank you received: 38
  • Karma: 17
thanks, We will evaluate your request..
The administrator has disabled public write access.
Powered by Kunena Forum