December 3, 2017

Issue: Simulator is running very slow on MAC

The Simulator is responding very slow on my MAC book while running apps. The issue here I found is somehow slow animations are enabled in the simulator. The solution for this is press "Command+T" on the simulator.  It may be simple and funny, but it worked for me. Try yourself :).

October 14, 2017

Working with Oracle MCS Database Management API

­­­­In Oracle Mobile Cloud Service (MCS) "Database Management API" is another API in addition to "Database Access API" which lets you view table metadata, and create, drop, and re-create tables. This post is not to explain about the API but to see how to access it from outside. Please click here to know more about the API.

The good part of this API is, you can access this API from outside of MCS using any rest client tool. 
In this example, I am using Postman.

To access the “Database Management API” from outside, you need to pass MCS login credentials instead of mobile backend authentication details along with mobile backend id to every API.

Below is a screenshot for your reference where it is fetching meta data of my table “MY_CUSTOMER”. Note that the table name here is case sensitive.


Below is the full output of the above GET operation to fetch meta data of a table "MY_CUSTOMER".

{
    "name": "MY_CUSTOMER",
    "primaryKeys": [
        "id"
    ],
    "requiredColumns": [
        "id"
    ],
    "columns": [
        {
            "name": "id",
            "type": "decimal"
        },
        {
            "name": "vehiclenum",
            "size": 6,
            "type": "string"
        },
        {
            "name": "customermobile",
            "size": 14,
            "type": "string"
        },
        {
            "name": "customernum",
            "size": 7,
            "type": "integer"
        },
        {
            "name": "customername",
            "size": 8,
            "type": "string"
        },
        {
            "name": "vehicleserial",
            "size": 9,
            "type": "string"
        },
        {
            "name": "createdBy",
            "size": 80,
            "type": "string"
        },
        {
            "name": "createdOn",
            "type": "dateTime"
        },
        {
            "name": "modifiedBy",
            "size": 80,
            "type": "string"
        },
        {
            "name": "modifiedOn",
            "type": "dateTime"
        }
    ]
}

Below are the other operations and APIs allowed with Database Management API.
  • To list all the tables in the MCS database:

URL: https://<MCS API URI>/mobile/system/databaseManagement/tables
Operation: GET
  •       To list meta data of a table in the MCS database:

URL: https://<MCS API URI>/mobile/system/databaseManagement/tables/<Table Name>
Operation: GET
  •     To drop table in the MCS database:

URL: https://<MCS API URI>/mobile/system/databaseManagement/tables/<Table Name>
Operation: DELETE
  •    To create a new table in the MCS database:

URL: https://<MCS API URI>/mobile/system/databaseManagement/tables
Operation: POST
Input:
{ "name" : "MY_CUSTOMER",
  "columns": [
    {"name": " id", "type": "integer", "size": 3},
    {"name": " vehiclenum", "type": "string", "size": 50},
    {"name": " customermobile", "type": "string"},
    {"name": " customernum", "type": "integer", "size": 3},
    {"name": " customername", "type": "string"},
    {"name": " vehicleserial", "type": "string"}
],
  "primaryKeys" : [ "id" ],
  "requiredColumns": ["id", "vehiclenum" ]
}

September 25, 2017

Passwordless Login using Account Kit, SDK from Facebook

Many apps are required to register. As per a survey, many users are leaving apps just because they don’t remember passwords. Many users don’t enter the app as they don’t like the long registration process. Even If the app provides social login (like Facebook login), few users do not want to share their social account details with the apps.

Another survey tells that users are interested to register using their phone numbers as smart phone users are growing. So, the best way to get more users to any app is to provide sign up using either
  • Phone number
  • Or Email
  • Or Social logins like Facebook

Social login is a common implementation, many developers may already know how to implement. But if you want to authenticate using either of the first two methods, then Facebook is providing an SDK called Account Kit to register using just phone number or email.
Click here to know more details about Account Kit

August 8, 2017

Routing in Oracle JET - Know how to navigate between pages

Routing is very useful in JET when we want to navigate between pages or modules. Following is the step-by-step procedure to configure the routing in Oracle JET.

·       Open main.js under sr/js folder
·       Search for function init() . By default, you see the below statements when you create a new project in this function

ko.applyBindings(new MainViewModel(), document.getElementById('globalBody'));
app.adjustContentPadding();

·       Replace these lines with the below statements in the function

oj.Router.sync().then(
                            function () {
                                // Bind your ViewModel for the content of the whole page body.
                                ko.applyBindings(app, document.getElementById('globalBody'));
                            },
                            function (error) {
                                oj.Logger.error('Error in root start: ' + error.message);
                            }
                    );
  
·       Open appController.js under src/js folder
·       In the function ControllerViewModel(), add the following code

self.router = oj.Router.rootInstance;      
                self.router.configure({
                    'home': {label: 'Home', isDefault: true},
                    'dashboard': {label: 'Dashboard'}
                });
                oj.Router.defaults['urlAdapter'] = new oj.Router.urlParamAdapter();
function mergeConfig(original) {
                    return $.extend(true, {}, original, {
                        'animation': oj.ModuleAnimations.switcher(switcherCallback)
                    });
                }

                self.moduleConfig = mergeConfig(self.router.moduleConfig);               

·       We need to configure all the pages for which we need to apply the routing. In the above code, observe the highlighted lines under self.router.configure(). Similarly, replace these pages with your pages
·       Open index.html under src folder. Copy and paste the below line under div tag with id "globalBody" where the routing will be applied

<div data-bind="ojModule: moduleConfig"></div>

·       Now the router is ready
·       Whenever you want to navigate to another page, then call the below method.
self.router.go(<page id>);
Ex: if you want to go to dashboard, then use self.router.go('dashboard');

June 20, 2017

Issue: REST web services are created in AppModule but disappeared

[JDev 12.1.3]

Issue:

I have created an ADF application in JDeveloper 12.1.3 in which I created restful web services in the app module for the business components. I created another ViewObject by custom sql query and added to app module and created rest services for it. Suddenly all my existing rest services are disappeared from the app module window and + button under REST tab is also disabled as shown in the below image. There is no error or alert shown.


I can see the xml files in the project structure but are not appeared in the AppModule window.

Solution:

While creating my new view object by sql , I have not given any key attribute and added it to app module. I rolled back my changes and created the same view object with a key attribute and created rest service for the same view object now and it worked. It added to the list of rest services in the app module and all are appeared.

When you create rest service to any VO, an xml file like below is created.
 "AppModule_<ResourceName>Resource.xml"

When you delete the REST service, this file will not be deleted. If you try to create REST service again with the same name, then also you face the above issue. So, check if this xml file is deleted from the project before creating new one.

June 5, 2017

Oracle MAF 2.4.0 released

The new release of version 2.4.0 of Oracle Mobile Application Framework (MAF) is announced recently. This is a major release containing significant enhancements, such as improved Android builds, shared data controls, shared libraries and iOS 3D touch support, to name a few.

Please refer to the What's New section of the developer guide for detailed information about the changes and how they may affect you.

Visit the MAF Blog for more details.


May 18, 2017

Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

While building an android app in Android Studio, I got the below error and the build was failed.

Error: The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

The solution to avoid this error is, add the property "multiDexEnabled true" under defaultConfig in app's build.graddle file. It will look like below.

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.sonuappz.app"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }


Update:

The above solution works for the issue but the root cause is because of multiple libraries added in the app may have same references inside. Try to identify what library exactly needed for the app and remove the extras. If still the issue occurs, above is the solution for it.

April 27, 2017

Error: oracle.maf.impl.cd.datasynch not found

[maf 2.3.1]

I am developing a mobile application with MCS offline sync feature using Oracle MAF. I have used AMPA for the implementation. After deploying the application, on click of "Pending Sync Actions", I got the below error.

Feature not found with id "oracle.maf.impl.cd.datasynch"



This is because the library might be deleted or corrupted in the application. To avoid this error, we need to re-add the library. Below is the procedure to do so.
  • Go to application properties -> Libraries and Classpath
  • If you see libraries "DataSynchFeature.jar" and "WebServiceCallsFeature.jar", remove them
  • Click on "Add JAR/Directory..." and go to the path <jdev_home>/jdeveloper/jdev/extensions/oracle.maf/FARs/CDM
  • Selet both the jar files "DataSynchFeature.jar" and "WebServiceCallsFeature.jar" and add them
  • Click Ok
Now clean and re-deploy the application. It worked for me.




February 14, 2017

Error: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted

[JDev 12.1.3]

I have created an EntityObject in the Model project and assigned a DB sequence to the key attribute of it. While running the project, I got the below error.

[Static type checking] - [ADF security error] Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.


To avoid this issue,
  • Go to the source of the entity object xml file
  • Search for the tag "TransientExpression"
  • Check the attribute trustMode. It may have the value "untrusted"
  • Change the value to "trusted". Save and run the app
Now the issue should be solved.

Note: The same solution is given in my previous post for the below error. This solution worked for both the issues.