Use StorageService inside Custom Code Service

0 votes

Can i use Storage service in side my custom code service ??

I have used but without throwing error it gets run but its not going in to the onSuccess or even onException 

can you please provide me solution ?

	
// here sp is Service api Object

StorageService service = sp.buildStorageService();
			
				service.findAllCollections("CHASETHEACE", new App42CallBack() {  
				public void onSuccess(Object response)  
				{  
				    Storage  storage  = (Storage )response;  

				   try {
					main_obj.put("DBNAME","Helloooooooo");
				} catch (JSONException e) {
				}
				   
				}  
				public void onException(Exception ex)   
				{  
				}  
				});  
			
			main_obj.put("Message", card_value_array);
		} catch (JSONException e) {
			e.printStackTrace();
		}

 

asked Jul 1, 2016 in Android by testdemo772 (47 points)

1 Answer

+1 vote
 
Best answer

Hi TestDemo,

 

Please use synchronous API instead of Asynchronous, it will work for you. Let me know if you need any help from my side. 

I will be happy to help you!

P.S Use below code to get list of collections inside custom code:

String dbName = "Your_DataBase_Name";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllCollections(dbName);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
 

Regards,

Himanshu Sharma

answered Jul 1, 2016 by hs00105 (2,005 points)
selected Jul 2, 2016 by testdemo772
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...